import {Component  } from "react";

class App extends Component{

  state={
    val:'hi'
  }

  handlerChange=(e)=>{
    console.log('事件对象',e.target.value);
    this.setState({
      val:e.target.value
    })

  }

  render(){
    return(
      <div>
        <h1>受控组件</h1>
        <hr />
        <p>
          <input type="text" value={this.state.val} onChange={this.handlerChange}/>
        </p>
      </div>
    )
  }
}

export default App